package com.eduadmin.service;

import com.eduadmin.entity.Score;
import com.eduadmin.entity.TeachScore;
import com.eduadmin.mapper.ScoreMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ScoreServiceImpl implements IScoreService {

    private final ScoreMapper scoreMapper ;
    @Autowired
    public ScoreServiceImpl(ScoreMapper scoreMapper){
        this.scoreMapper = scoreMapper;
    }


    @Override
    public void addScores(Map<String,Object> maps) {
        scoreMapper.insertScores(maps);
    }
    public List<Score> getAllScoreByParam(String gradeDatatableName,String semesterName,String examName,String categoryName){
        return scoreMapper.getAllScoreByParam(gradeDatatableName,semesterName,examName,categoryName);
    }
    public List<Score> getTeamCourseScoreByParam(String gradeDatatableName,String semesterName,String examName,String categoryName,String teamName,String courseEnName){
        return scoreMapper.getTeamCourseScoreByParam(gradeDatatableName,semesterName,examName,categoryName,teamName,courseEnName);
    }

    @Override
    public Score getScoreUnique(Map<String,Object> maps) {
        return scoreMapper.selectScoreUnique(maps);
    }

    @Override
    public List<Score> getAllScores(Map<String, Object> paraMap) {
        return scoreMapper.selectAllScores(paraMap);
    }

    @Override
    public Long getAllScoreTotal(Map<String, Object> paraMap) {
        return scoreMapper.selectAllScoreCount(paraMap);
    }

    @Override
    public List<TeachScore> getTeachScores(Map<String, Object> paraMap) {
        return scoreMapper.selectTeachScores(paraMap);
    }

    @Override
    public List<Score> exportQueryStudentScores(Map<String, Object> paraMap) {
        return scoreMapper.selectQueryStudentScores(paraMap);
    }

    @Override
    public void updateStudentScore(Map<String, Object> maps) {
        scoreMapper.updateStudentScore(maps);
    }

    @Override
    public long deleteStudentScore(Map<String, String> paraMap) {
        return scoreMapper.deleteStudentScore(paraMap);
    }

    // （教师使用）
    @Override
    public  List<TeachScore> getTeachScoreByParam(Map<String,Object> paraMap){
        return scoreMapper.getTeachScoreByParam(paraMap);
    }
    // 教师使用：从指定的年级成绩表中返回满足条件的所有记录“条数”。条件：年级数据表名，年级，班级名称，学期，考试，学科。
    @Override
    public int getTeachScoreNumberByParam(Map<String,Object> paraMap){
        return scoreMapper.getTeachScoreNumberByParam(paraMap);
    }
    // 教师使用：（不带分页条件）从指定的年级成绩表中返回满足条件的所有记录。条件：年级数据表名，年级，班级名称，学期，考试，学科。
    @Override
    public List<TeachScore> getTeachScoreForExportByParam(Map<String, Object> paraMap) {
        return scoreMapper.getTeachScoreForExportByParam(paraMap);
    }
    // （学生使用）：从给定的“年级成绩表名称”中查找到满足（学生身份证号）的所有记录。
    @Override
    public List<Score> getStudentOwnScoreByParam(Map<String,Object> paraMap){
        return scoreMapper.getStudentOwnScoreByParam(paraMap);
    }
}
